<?php
ini_set("display_errors", "On");//打开错误提示
ini_set("error_reporting", E_ALL);//显示所有错误
define("QAPP", 1);
define("DEBUG", 1);
define("AppDir", "../../application/");
define("CoreDir", "../../core/");
include "QAppDB.php";
//echo file_exists('../../core/data/data.json');
include CoreDir . "version.php";
include "func.php";
?>
<!doctype html>
<html lang="zh">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <link rel="stylesheet" href="../assets/css/bootstrap.min.css">

    <?php
    $step = getGet("step", 10);
    $title = "";
    $step = $step ? $step : 10;

    $step = $step * 1;
    if ($step < 1 || $step > 50) {
        $step = 10;
    }
    if ($step > 20) {
        $nextstep = session_get("step");
        //如果还不允许到达此步骤，则退回到此步骤
        if ($nextstep < $step) {
            header("Location:?step={$nextstep}");
            exit();
        }
    }

    switch ($step) {
        case 10:
            $title = "QAPP安装检查";
            break;
        case 20:
            $title = "PHP环境检测";

            break;
        case 30:
            $title = "伪静态检查";

            break;
        case 40:
            $title = "数据库安装";

            break;
        case 50:
            $title = "安装完成";

            break;
    }
    ?>
    <title>安装QAPP - <?php echo $title ?></title>
</head>
<body>
<div style="text-align: center;padding: 30px">
    <img src="qapp.png" style="height: 100px" alt="">
    <h1>安装QAPP - <?php echo version ?></h1>
</div>

<div class="container theme-showcase" role="main" style="padding-bottom: 50px">
    <div class="panel panel-info" >
        <div class="panel-heading">
            <h3 class="panel-title"><?php if ($step > 10 && $step < 50) { ?><a class="btn btn-default"
                                                                               href="javascript:history.back(-1)">上一步</a> <?php } ?> <?php echo ($step / 10) . "、" . $title ?>
            </h3>
        </div>
        <div class="panel-body">
            <?php

            //dumpForInstall($extension);
            /** 安装步骤
             * 检查环境
             * 1、检查是否已经安装过，application/apphash.php文件是否存在
             * 2、扩展库是否安装
             * 3、伪静态检查
             * 4、数据库安装
             * 5、安装完成
             */


            switch ($step) {
                case 10:
//        $title = "QAPP是否已经安装";
                    include "step10.php";
                    break;
                case 20:
//        $title = "环境检测";
                    include "step20.php";

                    break;
                case 30:
//        $title = "伪静态检查";
                    include "step30.php";

                    break;
                case 40:
//        $title = "数据库安装";
                    include "step40.php";

                    break;
                case 50:
//        $title = "安装完成";
                    include "step50.php";

                    break;
            }


            ?>


        </div>
    </div>
    <footer class="navbar-fixed-bottom text-center" style="padding: 10px 0;background-color: #e7e7e7">&copy;<?php echo(date('Y')); ?> <a
                href="https://gitee.com/withu2018/qapp"
                target="_blank">withu2018</a>
    </footer>
</div>
</body>
</html>

